<html>
<head>
    <title>PHP test</title>
</head>
<body>
<pre>
    <?php
    require 'signer.php';
    $signer = new Signer();
    $signer->Key = 'apigateway_sdk_demo_key';
    $signer->Secret = "apigateway_sdk_demo_secret";

    $req = new Request('POST', "https://30030113-3657-4fb6-a7ef-90764239b038.apigw.cn-north-1.huaweicloud.com/app1?a=1");
    $req->headers = array(
        'content-type' => 'application/json',
        'x-stage' => 'RELEASE',
    );
    $req->body = '';
    $curl = $signer->Sign($req);

    var_dump($req->headers);
    echo "--------------\n";
    $response = curl_exec($curl);
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if ($status == 0) {
        echo curl_error($curl);
    } else {
        echo $status . "\n";
        echo $response;
    }
    curl_close($curl);
    ?>
</pre>
</body>
</html>